package com.moody.hibernate.dao;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;

import org.hibernate.Criteria;
import org.hibernate.LockMode;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.criterion.MatchMode;
import org.hibernate.criterion.Restrictions;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import org.springframework.transaction.annotation.Transactional;

import com.moody.hibernate.domain.CustInfo;
import com.moody.hibernate.domain.PdH;
import com.moody.init.DataDictionary;

/**
 * A data access object (DAO) providing persistence and search support for
 * CustInfo entities. Transaction control of the save(), update() and delete()
 * operations can directly support Spring container-managed transactions or they
 * can be augmented to handle user-managed Spring transactions. Each of these
 * methods provides additional information for how to configure it for the
 * desired type of transaction control.
 * 
 * @see com.moody.hibernate.domain.CustInfo
 * @author MyEclipse Persistence Tools
 */
public class CustInfoDAO extends HibernateDaoSupport {
	private static final Logger log = LoggerFactory
			.getLogger(CustInfoDAO.class);
	// property constants
	public static final String ORGANIZATION_ID = "organizationId";
	public static final String CUST_NAME = "custName";
	public static final String ENGLISH_NAME = "englishName";
	public static final String SIMPLE_NAME = "simpleName";
	public static final String SIMPLE_EN_NAME = "simpleEnName";
	public static final String BUSI_LICENSE_ID = "busiLicenseId";
	public static final String BELONG_TYPE = "belongType";
	public static final String ORG_TYPE = "orgType";
	public static final String ESTABLISH_DATE = "establishDate";
	public static final String CLOSE_DATE = "closeDate";
	public static final String REGISTERCAPITAL = "registercapital";
	public static final String CAPITAL_CURRENCY = "capitalCurrency";
	public static final String RECEIVE_RATE = "receiveRate";
	public static final String REVENUE_SOURCE = "revenueSource";
	public static final String CUST_TYPE = "custType";
	public static final String CUST_STATUS = "custStatus";
	public static final String CUST_SCOPE = "custScope";
	public static final String INDUSTRY_TYPE = "industryType";
	public static final String BUSI_SCOPE = "busiScope";
	public static final String LAST3AVGINCOME = "last3avgincome";
	public static final String LAST_INCOME = "lastIncome";
	public static final String LAST2INCOME = "last2income";
	public static final String ASSET_SUM = "assetSum";
	public static final String DEBT_SUM = "debtSum";
	public static final String OTHER_DESC = "otherDesc";
	public static final String EXT_RAT_RESULT = "extRatResult";
	public static final String EXT_RAT_ORG = "extRatOrg";
	public static final String EXT_RAT_DATE = "extRatDate";
	public static final String INDUSTRY_RISK_LEVEL = "industryRiskLevel";
	public static final String REGION_RISK_LEVEL = "regionRiskLevel";
	public static final String FINANC_RISK_LEVEL = "financRiskLevel";
	public static final String CREDIT_LEVEL = "creditLevel";
	public static final String FIRST_CREDIT_LEVEL = "firstCreditLevel";
	public static final String DEFAULT_STAT = "defaultStat";
	public static final String EXPOSURE_TYPE = "exposureType";
	public static final String INPUT_USER_ID = "inputUserId";
	public static final String INPUT_ORG_ID = "inputOrgId";
	public static final String INPUT_DATE = "inputDate";
	public static final String UPDATE_USER_ID = "updateUserId";
	public static final String UPDATE_ORG_ID = "updateOrgId";
	public static final String UPDATE_DATE = "updateDate";

	protected void initDao() {
		// do nothing
	}

	public void save(CustInfo transientInstance) {
		log.debug("saving CustInfo instance");
		try {
			getHibernateTemplate().save(transientInstance);
			log.debug("save successful");
		} catch (RuntimeException re) {
			log.error("save failed", re);
			throw re;
		}
	}

	public void delete(CustInfo persistentInstance) {
		log.debug("deleting CustInfo instance");
		try {
			getHibernateTemplate().delete(persistentInstance);
			log.debug("delete successful");
		} catch (RuntimeException re) {
			log.error("delete failed", re);
			throw re;
		}
	}

	public CustInfo findById(java.lang.String id) {
		log.debug("getting CustInfo instance with id: " + id);
		try {
			CustInfo instance = (CustInfo) getHibernateTemplate().get(
					"com.moody.hibernate.domain.CustInfo", id);
			return instance;
		} catch (RuntimeException re) {
			log.error("get failed", re);
			throw re;
		}
	}
	

	public List findByExample(CustInfo instance) {
		log.debug("finding CustInfo instance by example");
		try {
			List results = getHibernateTemplate().findByExample(instance);
			log.debug("find by example successful, result size: "
					+ results.size());
			return results;
		} catch (RuntimeException re) {
			log.error("find by example failed", re);
			throw re;
		}
	}

	public List findByProperty(String propertyName, Object value) {
		log.debug("finding CustInfo instance with property: " + propertyName
				+ ", value: " + value);
		try {
			String queryString = "from CustInfo as model where model."
					+ propertyName + "= ?";
			return getHibernateTemplate().find(queryString, value);
		} catch (RuntimeException re) {
			log.error("find by property name failed", re);
			throw re;
		}
	}

//	public List findByOrganizationId(Object organizationId) {
//		return findByProperty(ORGANIZATION_ID, organizationId);
//	}
//
//	public List findByCustName(Object custName) {
//		return findByProperty(CUST_NAME, custName);
//	}
//
//	public List findByEnglishName(Object englishName) {
//		return findByProperty(ENGLISH_NAME, englishName);
//	}
//
//	public List findBySimpleName(Object simpleName) {
//		return findByProperty(SIMPLE_NAME, simpleName);
//	}
//
//	public List findBySimpleEnName(Object simpleEnName) {
//		return findByProperty(SIMPLE_EN_NAME, simpleEnName);
//	}
//
//	public List findByBusiLicenseId(Object busiLicenseId) {
//		return findByProperty(BUSI_LICENSE_ID, busiLicenseId);
//	}
//
//	public List findByBelongType(Object belongType) {
//		return findByProperty(BELONG_TYPE, belongType);
//	}
//
//	public List findByOrgType(Object orgType) {
//		return findByProperty(ORG_TYPE, orgType);
//	}
//
//	public List findByEstablishDate(Object establishDate) {
//		return findByProperty(ESTABLISH_DATE, establishDate);
//	}
//
//	public List findByCloseDate(Object closeDate) {
//		return findByProperty(CLOSE_DATE, closeDate);
//	}
//
//	public List findByRegistercapital(Object registercapital) {
//		return findByProperty(REGISTERCAPITAL, registercapital);
//	}
//
//	public List findByCapitalCurrency(Object capitalCurrency) {
//		return findByProperty(CAPITAL_CURRENCY, capitalCurrency);
//	}
//
//	public List findByReceiveRate(Object receiveRate) {
//		return findByProperty(RECEIVE_RATE, receiveRate);
//	}
//
//	public List findByRevenueSource(Object revenueSource) {
//		return findByProperty(REVENUE_SOURCE, revenueSource);
//	}
//
//	public List findByCustType(Object custType) {
//		return findByProperty(CUST_TYPE, custType);
//	}
//
//	public List findByCustStatus(Object custStatus) {
//		return findByProperty(CUST_STATUS, custStatus);
//	}
//
//	public List findByCustScope(Object custScope) {
//		return findByProperty(CUST_SCOPE, custScope);
//	}
//
//	public List findByIndustryType(Object industryType) {
//		return findByProperty(INDUSTRY_TYPE, industryType);
//	}
//
//	public List findByBusiScope(Object busiScope) {
//		return findByProperty(BUSI_SCOPE, busiScope);
//	}
//
//	public List findByLast3avgincome(Object last3avgincome) {
//		return findByProperty(LAST3AVGINCOME, last3avgincome);
//	}
//
//	public List findByLastIncome(Object lastIncome) {
//		return findByProperty(LAST_INCOME, lastIncome);
//	}
//
//	public List findByLast2income(Object last2income) {
//		return findByProperty(LAST2INCOME, last2income);
//	}
//
//	public List findByAssetSum(Object assetSum) {
//		return findByProperty(ASSET_SUM, assetSum);
//	}
//
//	public List findByDebtSum(Object debtSum) {
//		return findByProperty(DEBT_SUM, debtSum);
//	}
//
//	public List findByOtherDesc(Object otherDesc) {
//		return findByProperty(OTHER_DESC, otherDesc);
//	}
//
//	public List findByExtRatResult(Object extRatResult) {
//		return findByProperty(EXT_RAT_RESULT, extRatResult);
//	}
//
//	public List findByExtRatOrg(Object extRatOrg) {
//		return findByProperty(EXT_RAT_ORG, extRatOrg);
//	}
//
//	public List findByExtRatDate(Object extRatDate) {
//		return findByProperty(EXT_RAT_DATE, extRatDate);
//	}
//
//	public List findByIndustryRiskLevel(Object industryRiskLevel) {
//		return findByProperty(INDUSTRY_RISK_LEVEL, industryRiskLevel);
//	}
//
//	public List findByRegionRiskLevel(Object regionRiskLevel) {
//		return findByProperty(REGION_RISK_LEVEL, regionRiskLevel);
//	}
//
//	public List findByFinancRiskLevel(Object financRiskLevel) {
//		return findByProperty(FINANC_RISK_LEVEL, financRiskLevel);
//	}
//
//	public List findByCreditLevel(Object creditLevel) {
//		return findByProperty(CREDIT_LEVEL, creditLevel);
//	}
//
//	public List findByFirstCreditLevel(Object firstCreditLevel) {
//		return findByProperty(FIRST_CREDIT_LEVEL, firstCreditLevel);
//	}
//	
//	public List findByDefaultStat(Object defaultStat) {
//		return findByProperty(DEFAULT_STAT, defaultStat);
//	}
//	
//	public List findByExposureType(Object exposureType) {
//		return findByProperty(EXPOSURE_TYPE, exposureType);
//	}
//
//	public List findByInputUserId(Object inputUserId) {
//		return findByProperty(INPUT_USER_ID, inputUserId);
//	}
//
//	public List findByInputOrgId(Object inputOrgId) {
//		return findByProperty(INPUT_ORG_ID, inputOrgId);
//	}
//
//	public List findByInputDate(Object inputDate) {
//		return findByProperty(INPUT_DATE, inputDate);
//	}
//
//	public List findByUpdateUserId(Object updateUserId) {
//		return findByProperty(UPDATE_USER_ID, updateUserId);
//	}
//
//	public List findByUpdateOrgId(Object updateOrgId) {
//		return findByProperty(UPDATE_ORG_ID, updateOrgId);
//	}
//
//	public List findByUpdateDate(Object updateDate) {
//		return findByProperty(UPDATE_DATE, updateDate);
//	}

	public List findAll() {
		log.debug("finding all CustInfo instances");
		try {
			String queryString = "from CustInfo";
			return getHibernateTemplate().find(queryString);
		} catch (RuntimeException re) {
			log.error("find all failed", re);
			throw re;
		}
	}

	public CustInfo merge(CustInfo detachedInstance) {
		log.debug("merging CustInfo instance");
		try {
			CustInfo result = (CustInfo) getHibernateTemplate().merge(
					detachedInstance);
			log.debug("merge successful");
			return result;
		} catch (RuntimeException re) {
			log.error("merge failed", re);
			throw re;
		}
	}

	public void attachDirty(CustInfo instance) {
		log.debug("attaching dirty CustInfo instance");
		try {
			getHibernateTemplate().saveOrUpdate(instance);
			log.debug("attach successful");
		} catch (RuntimeException re) {
			log.error("attach failed", re);
			throw re;
		}
	}

	public void attachClean(CustInfo instance) {
		log.debug("attaching clean CustInfo instance");
		try {
			getHibernateTemplate().lock(instance, LockMode.NONE);
			log.debug("attach successful");
		} catch (RuntimeException re) {
			log.error("attach failed", re);
			throw re;
		}
	}

	public static CustInfoDAO getFromApplicationContext(ApplicationContext ctx) {
		return (CustInfoDAO) ctx.getBean("CustInfoDAO");
	}
	
	/*
	 *  以下方法由我们自己封装
	 */
	
	public void update(CustInfo transientInstance) {
		log.debug("saving CustInfo instance");
		try {
			getHibernateTemplate().update(transientInstance);
			log.debug("save successful");
		} catch (RuntimeException re) {
			log.error("save failed", re);
			throw re;
		}
	}
	
	public Boolean isCustExist(String custName, String custNo, String organizationID, String busiLicenseID){
		String queryString = "from CustInfo as model where model.custName = ? or " +
				"model.organizationId = ? or model.busiLicenseId = ?";
		List list = getHibernateTemplate().find(queryString,custName,organizationID,busiLicenseID);
		
		if(list.size() == 0)
			return false;
		else
			return true;
	}
	
	public List myCutomerList(String custType){
		String queryString = "from CustInfo as model where model.custType = ?";
		return getHibernateTemplate().find(queryString,custType);
	}
	
	public List findLimitCustByCustType(String custType, int start, int limit){
		String queryString = "from CustInfo where custType = " + custType;
		Session session = getHibernateTemplate().getSessionFactory().openSession();
		Query query = session.createQuery(queryString);
		query.setFirstResult(start);
		query.setMaxResults(limit);
		session.close();
		return query.list();
	}
	
	public void deleteById(String custId){
		String hql = "delete from CustInfo where custId = ?";
		Session session = getHibernateTemplate().getSessionFactory().openSession();
		Query query = session.createQuery(hql);
		query.setParameter("custId", custId);
		if(query.executeUpdate() > 0)
			log.info("删除成功");
		else
			log.info("删除0个元素");
		session.close();
	}
	
	public List findCustByCondition(String custType, String custName,
			String organizationId, String busiLicenseId){
		/*Criteria critera = getSession().createCriteria(CustInfo.class);
		if(custType!=null&&!custType.equals("")){
			critera.add(Restrictions.like("custType", custType,MatchMode.ANYWHERE));
		
		}
		if(custName!=null&&!custName.equals("")){
			critera.add(Restrictions.like("custName", custName,MatchMode.ANYWHERE)); 
		}
		if(organizationID!=null&&!organizationID.equals("")){
			critera.add(Restrictions.like("organizationId", organizationID,MatchMode.ANYWHERE));
		}
		if(busiLicenseID!=null&&!busiLicenseID.equals("")){
			critera.add(Restrictions.like("busiLicenseId", busiLicenseID,MatchMode.ANYWHERE));
		}
		return critera.list();*/
		
		String hql = "from CustInfo where custType like :custType and custName like :custName and organizationId like :organizationId and busiLicenseId like :busiLicenseId";
		Session session = getHibernateTemplate().getSessionFactory().openSession();
		Query query = session.createQuery(hql);
		query.setString("custType", "%"+custType+"%");
		query.setString("custName", "%"+custName+"%");
		query.setString("organizationId", "%"+organizationId+"%");
		query.setString("busiLicenseId", "%"+busiLicenseId+"%");
		List result = query.list();
		session.close();
		return result;
	}

	@SuppressWarnings("unchecked")
	public List<CustInfo> findByIdAndName(String condition, String keyword) {
		
		String hql = "from CustInfo where " + condition + " like :queryString";
		Session session = getHibernateTemplate().getSessionFactory().openSession();
		Query query = session.createQuery(hql);
		query.setString("queryString", "%"+keyword+"%");
		List resultList = query.list();
		session.close();
		return resultList;
	}

	public boolean isRetailCustExist(String custName, String custNo,String idtype, String idno) {
		String queryString = "from IndInfo as model where model.custName = ?  or " +
				"model.idtype = ? or model.idno = ?";
		List list = getHibernateTemplate().find(queryString,custName,idtype,idno);
		
		if(list.size() == 0)
			return false;
		else
			return true;
	}

	@SuppressWarnings("unchecked")
	public List<CustInfo> findCustByCondition(String custType, String custName,
			String organizationId, String busiLicenseId, String custScope,
			String orgCode, String industryType, String creditLevel, String defaultStat,String exposureType, String defaultDate) {
		List<CustInfo> resultList = new ArrayList<CustInfo>();
		String hql = "from CustInfo as c, PdH as p where c.custId = p.custId and c.custType like :custType and c.custName like :custName and " +
				"c.organizationId like :organizationId and c.busiLicenseId like :busiLicenseId "+
				"and c.custScope like :custScope and c.inputOrgId like :inputOrgId and c.industryType like :industryType "+
				"and p.confirmPdlevel like :creditLevel and c.defaultStat like :defaultStat and c.exposureType like :exposureType " + 
				"and p.confirmDate like :defaultDate";
		Session session = getHibernateTemplate().getSessionFactory().openSession();
		Query query = session.createQuery(hql);
		query.setString("custType", "%"+custType+"%");
		query.setString("custName", "%"+custName+"%");
		query.setString("organizationId", "%"+organizationId+"%");
		query.setString("busiLicenseId", "%"+busiLicenseId+"%");
		query.setString("custScope", "%"+custScope+"%");
		query.setString("inputOrgId", "%"+orgCode);
		query.setString("industryType", "%"+industryType+"%");
		query.setString("creditLevel", "%"+creditLevel+"%");
		query.setString("defaultStat","%" + defaultStat + "%");
		query.setString("exposureType","%" + exposureType + "%");
		query.setString("defaultDate","%" + defaultDate + "%");
		
		List<Object> list = query.list();
		for(Object item:list){
			Object[] items = (Object[]) item;
			CustInfo custInfo = (CustInfo)items[0];
			CustInfo custInfoNew = custInfo.clone();
			PdH pdh = (PdH)items[1];
//			if(pdh.getConfirmPdlevel() == null || pdh.getConfirmPdlevel().equals("") || pdh.getConfirmDate() == null || pdh.getConfirmDate().equals("")) continue;
			custInfoNew.setCreditLevel(pdh.getConfirmPdlevel());
			custInfoNew.setConfirmDate(pdh.getConfirmDate());
//			if(!resultList.contains(custInfo))resultList.add(custInfo);
			resultList.add(custInfoNew);
		}
		session.close();
		return resultList;
	}
	
	@SuppressWarnings("unchecked")
	public List<CustInfo> findCustByPdhCondition(Map<String,String> condition,Map<String,String> pdhCondition){
		List<CustInfo> resultList = new LinkedList<CustInfo>();
		String hql = "FROM CustInfo as c, PdH as p WHERE c.custId = p.custId AND p.phaseStat <> '08' AND "; //状态为“失效”的被忽略
		
		Set<String> keySet = condition.keySet();
		Iterator<String> it = keySet.iterator();
		while(it.hasNext()){
			String keyString = it.next();
			hql += "c."+keyString + " like :c" + keyString + " AND ";
		}
		Set<String> pdhKeySet = pdhCondition.keySet();
		it = pdhKeySet.iterator();
		while(it.hasNext()){
			String keyString = it.next();
			hql += "p."+keyString + " like :p" + keyString + " AND ";
		}
		hql = hql.substring(0,hql.length() - 5);
		
		Session session = getHibernateTemplate().getSessionFactory().openSession();
		Query query = session.createQuery(hql);
		it = keySet.iterator();
		while(it.hasNext()){
			String keyString = it.next();
			query.setString("c"+keyString, "%" + condition.get(keyString) +"%");
		}
		it = pdhKeySet.iterator();
		while(it.hasNext()){
			String keyString = it.next();
			query.setString("p"+keyString, "%" + pdhCondition.get(keyString) +"%");
		}
		
		List<Object> list = query.list();
		for(Object item:list){
			Object[] items = (Object[]) item;
			CustInfo custInfo = (CustInfo)items[0];
			CustInfo custInfoNew = custInfo.clone();
			PdH pdh = (PdH)items[1];
//			if(pdh.getConfirmPdlevel() == null || pdh.getConfirmPdlevel().equals("") || pdh.getConfirmDate() == null || pdh.getConfirmDate().equals("")) continue;
			custInfoNew.setCreditLevel(pdh.getConfirmPdlevel());
			custInfoNew.setConfirmDate(pdh.getConfirmDate());
			custInfoNew.setPhaseStat(DataDictionary.getInstance().getNameByCodeAndId("PhaseStat", pdh.getPhaseStat()));
//			if(!resultList.contains(custInfo))resultList.add(custInfo);
			resultList.add(custInfoNew);
		}
		session.close();
		return resultList;
	}

	@SuppressWarnings("unchecked")
	public List<CustInfo> findBiggestCustByCondition(String custType,String custScope, String exposureType,
			String orgCode, String industryType, String creditLevel,String defaultStat) {
		String hql = "from CustInfo where custType like :custType  and custScope like :custScope and exposureType like :exposureType and inputOrgId like :inputOrgId " +
				"and industryType like :industryType and creditLevel like :creditLevel and defaultStat like :defaultStat";
		Session session = getHibernateTemplate().getSessionFactory().openSession();
		Query query = session.createQuery(hql);
		query.setString("custType", "%"+custType+"%");
		query.setString("custScope", "%"+custScope+"%");
		query.setString("exposureType", "%"+exposureType+"%");
		query.setString("inputOrgId", "%"+orgCode);
		query.setString("industryType", "%"+industryType+"%");
		query.setString("creditLevel", "%"+creditLevel+"%");
		query.setString("defaultStat","%" + defaultStat + "%");
		
		List resultList = query.list();
		session.close();
		return resultList;
	}
	
	@SuppressWarnings("unchecked")
	public List<CustInfo> findCustByCondition(Map<String,String> condition){
		String hql = "FROM CustInfo WHERE ";
		Set<String> keySet = condition.keySet();
		Iterator<String> it = keySet.iterator();
		while(it.hasNext()){
			String keyString = it.next();
			hql += keyString + " like :" + keyString + " AND ";
		}
		hql = hql.substring(0,hql.length() - 5);
		Session session = getHibernateTemplate().getSessionFactory().openSession();
		Query query = session.createQuery(hql);
		it = keySet.iterator();
		while(it.hasNext()){
			String keyString = it.next();
			query.setString(keyString, "%" + condition.get(keyString) +"%");
		}
		List<CustInfo> resultList = query.list();
		session.close();
		return resultList;
	}
	
	@SuppressWarnings("unchecked")
	public List<CustInfo> findCustInfo(String custType, String userId,List<String> orgIdList){
		if(orgIdList == null || orgIdList.size() == 0){
			String hql = "FROM CustInfo WHERE custType like :custType AND inputUserId like :userId";
			Session session = getHibernateTemplate().getSessionFactory().openSession();
			Query query = session.createQuery(hql);
			query.setString("custType", "%"+custType+"%");
			query.setString("userId", userId);
			List<CustInfo> resultList = query.list();
			session.close();
			return resultList;
		}
		else{
			String orgIdArray = "";
			for(int i = 0; i < orgIdList.size();i++){
				orgIdArray += "?,";
			}
			orgIdArray = orgIdArray.substring(0, orgIdArray.length() - 1);
			String hql = "FROM CustInfo WHERE custType like ? AND (inputUserId = ? OR inputOrgId IN ("+orgIdArray+"))";
			Session session = getHibernateTemplate().getSessionFactory().openSession();
			Query query = session.createQuery(hql);
			query.setString(0, "%"+custType+"%");
			query.setString(1, userId);
			for(int i = 0; i < orgIdList.size(); i++){
				query.setString(i+2, orgIdList.get(i));
			}

			List<CustInfo> resultList = query.list();
			session.close();
			return resultList;
		}
		
	}
	
	public boolean updateInputOrgIdByInputUserId(String inputUserId,String inputOrgId){
		Session session = getHibernateTemplate().getSessionFactory().openSession();
		Transaction trans=session.beginTransaction();
		String hql="UPDATE CustInfo cust SET cust.inputOrgId='"+inputOrgId+"' WHERE cust.inputUserId='"+inputUserId+"'";
		Query queryupdate=session.createQuery(hql);
		int ret=queryupdate.executeUpdate();
		trans.commit();
		session.close();
		if(ret > 0) return true;
		else return false;
	}

	public String findByCustNo(String debtCustId) {
		String queryString = "from CustInfo as model where model.custNo = ?";
		List list = getHibernateTemplate().find(queryString,debtCustId);
		if(list.size() <= 0){
			return null;
		}else{
			return ((CustInfo)list.get(0)).getCustName();
		}
		
	}

	public String findCustIdByCustNo(String debtCustId) {
		String queryString = "from CustInfo as model where model.custNo = ?";
		List list = getHibernateTemplate().find(queryString,debtCustId);
		if(list.size() <= 0){
			return null;
		}else{
			return ((CustInfo)list.get(0)).getCustId();
		}
	}
}